package com.clip.service;

import java.util.Calendar;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.clip.dao.ForbiddenEventDAO;
import com.clip.entity.ForbiddenEvent;

@Service
@Transactional
public class ForbiddenEventService {
	@Autowired
	private ForbiddenEventDAO forbiddenEventDAO;
	
	public List<ForbiddenEvent> getForbiddenEvents(Integer uid,Calendar time){
		Calendar obj=(Calendar) time.clone();
		obj.clear(Calendar.MILLISECOND);
		obj.clear(Calendar.SECOND);
		obj.clear(Calendar.MINUTE);
		obj.set(Calendar.HOUR_OF_DAY, 0);
		String query="from ForbiddenEvent view where view.uid="+uid+" and view.updatetime>="+obj.getTimeInMillis();
		return forbiddenEventDAO.findByQuery(query);
	}
}
